import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
// import login from '@/components/pages/Firstlevelrouting/login/login'
import login1 from '@/components/pages/Firstlevelrouting/login/login1'
import msite from '@/components/pages/Firstlevelrouting/msite/msite'
import shoplist from '@/components/pages/Firstlevelrouting/msite/shoplist'
import search from '@/components/pages/Firstlevelrouting/search/search'
import order from '@/components/pages/Firstlevelrouting/order/order'
import profile from '@/components/pages/Firstlevelrouting/profile/profile'
import ShopGoods from '@/components/pages/Twolevelrouting/goods/goods'
import ShopRatings from '@/components/pages/Twolevelrouting/goods/ShopRatings'
import ShopHeader from '@/components/pages/Twolevelrouting/goods/ShopHeader'
import Food from '@/components/pages/Twolevelrouting/goods/Food'
import CartControl from '@/components/pages/Twolevelrouting/goods/CartControl'
import Shop from '@/components/pages/Twolevelrouting/goods/Shop'
import ShopInfo from '@/components/pages/Twolevelrouting/info/ShopInfo'
import ShopCart from '@/components/pages/Twolevelrouting/goods/ShopCart'
import alertTip from '@/components/pages/alerttip/AlertTip'

Vue.use(Router)
export default new Router({
  routes: [
    {
      path: '/HelloWorld',
      name: 'HelloWorld',
      component: HelloWorld
    },{
      path: '/login',
      name: 'login',
      component: resolve => require(["@/components/pages/Firstlevelrouting/login/login"],resolve)

    },{
      path: '/login1',
      name: 'login1',
      component: login1
    },{
      path: '/msite',
      name: 'msite',
      component: msite
    },{
      path: '/search',
      name: 'search',
      component: search
    },{
      path: '/order',
      name: 'order',
      component: order
    },{
      path: '/profile',
      name: 'profile',
      component: profile
    },{
      path: '/Food',
      name: 'Food',
      component: Food
    },{
      path: '/CartControl',
      name: 'CartControl',
      component: CartControl
    },{
      path: '/ShopCart',
      name: 'ShopCart',
      component: ShopCart
    },{
      path: '/alertTip',
      name: 'alertTip',
      component: alertTip
    },{
      path: '/ShopHeader',
      name: 'ShopHeader',
      component: ShopHeader
    },{
      path: '/Shop',
      name: 'Shop',
      component: Shop,
      children: [
        {
          path: '/shop/goods',
          component: ShopGoods
        },{
          path: '/shop/ShopRatings',
          component: ShopRatings
        },{
          path: '/shop/ShopInfo',
          component: ShopInfo
        },
      ]
    }
  ]
})
// const vueRoter=new VueRuter({
//   routes: [
//     {
//       path: '/foo',
//       component: Foo,
//       beforeEnter: (to, from, next) => {
//         //do something
//       }
//     }
//   ]
// })
// const whiteList = ['/login'] //理由白名单
// vueRoter.beforeEach(function (to,form,next) {
//   console.log('进入守卫')
//   if(userInfo.uesr_id>0){
//     console.log('登陆成功')
//     next();//必须执行
//   }else{
//
//   }
// });
// export default vueRoter
